package com.den.controller;

import com.den.entity.Video;
import com.den.mapper.VideoMapper;
import com.den.service.VideoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;

import java.util.List;

@Controller
public class VideoController {
    //表明身份@Controller
    //复制service方法
    //修改    @Autowired//自动装配 下面依赖的对象 由mapper 改成 service(不是实现类)
    //将所有的Boolean类型改为String
    @Autowired//自动装配
    private VideoService videoService;

    public List<Video> selectAllVideos() {
        return videoService.selectAllVideos();
    }


    public List selectVideoById(int id) {
        return videoService.selectVideoById(id);
    }


    public String deleteVideoById(int id) {
        return videoService.deleteVideoById(id)?"成功":"失败";
    }


    public String insertVideoById(Video video) {
        return videoService.insertVideoById(video)?"成功":"失败";
    }


    public String updateVideoById(Video video) {
        return videoService.updateVideoById(video)?"成功":"失败";
    }
}
